//
//  PMShape.h
//  PezMonkey
//
//  Created by Spence DiNicolantonio on 10/29/09.
//  Copyright 2009 Necrosoft. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "PMCore.h"

@class PMBody;


#pragma mark Constants / Enums

// Collision layer mask
typedef NSUInteger PMLayerMask;
static const PMLayerMask PMLayerMaskAll = 0xFFFF;
static const PMLayerMask PMLayerMaskNone = 0x0000;

// Shape Types
typedef enum _PMShapeType {
	PMShapeTypeCircle,
	PMShapeTypeSegment,
	PMShapeTypePolygon,
} PMShapeType;

#pragma mark -


@interface PMShape : NSObject {
@protected
	// Chipmunk collision shape reference
	cpShape *shape;
	
@private
	// Corresponding PMBody object affected by collisions
	PMBody *body;
	
	// User defined data pointer.
	id data;
}

@property (nonatomic, retain) PMBody *body;
@property (nonatomic, retain) id data;


#pragma mark -
#pragma mark Getters
- (cpShape *)cpShape;
- (PMShapeType)type;
- (PMBoundingBox)boundingBox;
- (PMFloat)elasticity;
- (PMFloat)friction;
- (PMVect)surfaceVelocity;
- (NSUInteger)collisionType;
- (NSUInteger)collisionGroup;
- (PMLayerMask)layers;
- (NSUInteger)shapeID;


#pragma mark -
#pragma mark Setters
- (void)setElasticity:(PMFloat)elasticity;
- (void)setFriction:(PMFloat)friction;
- (void)setSurfaceVelocity:(PMVect)surfaceVelocity;
- (void)setCollisionType:(NSUInteger)collisionType;
- (void)setCollisionGroup:(NSUInteger)collisionGroup;
- (void)setLayers:(PMLayerMask)layers;


#pragma mark -
#pragma mark Other Methods
- (BOOL)isPointInShape:(PMVect)point;
+ (void)resetShapeIDCounter;

@end
